fix(perf): pass symbolsOnly through parseFilesWasmInline#1489
Conversation
… diff Adds snapshot-pre-bash.sh (PreToolUse Bash) + track-bash-writes.sh (PostToolUse Bash): the pre-hook captures git status --porcelain to a per-worktree temp file before each Bash call; the post-hook diffs the before/after state and appends newly modified or created files to .claude/session-edits.log. This closes the gap where files written by sed -i, printf redirects, tee, heredocs, or build tools (Cargo.lock, lockfiles) were never recorded, causing guard-git.sh to emit false-positive BLOCKED errors. Closes #1457
- clojure.rs: annotate lifetime-anchor assignment to silence false-positive - cfg.rs: remove never-called start_line_of method - complexity.rs: remove never-constructed NotHandled variant; convert irrefutable if-let patterns to plain let destructures - dataflow.rs: remove never-read callee fields from CallReturn/Destructured - incremental.rs: remove never-read lang field from CacheEntry cargo check and cargo clippy both clean after these changes.
Adds .github/workflows/perf-canary.yml — a path-filtered workflow that fires on PRs touching src/extractors/, src/domain/graph/, or crates/** and runs only the incremental-benchmark suite (full build + no-op + 1-file rebuild, both engines). Catches the class of regressions that accumulated invisibly across the Phase 8.x PRs and were only detected at v3.12.0 publish time. The regression guard gains BENCH_CANARY=1 mode: raises thresholds to 50%/100%/150% (standard/noisy/WASM) and skips the build, query, and resolution suites — only incremental checks run. This absorbs shared- runner timing variance while still blocking catastrophic regressions (+98% full build, +1827% 1-file rebuild from v3.12.0). Closes #1433
|
Claude finished @carlos-alm's task —— View job PR Review — fix(perf): pass symbolsOnly through parseFilesWasmInline
Root Cause AnalysisProblem Being Solved: Why This Approach: The fix is minimal and correct — add Risk Assessment: Low. The change path is Phase 2: Configuration Change Detection
Phase 3: Test Integrity
Coverage gap: There are no new unit tests specifically for the Phase 4: Code Quality
if (!symbolsOnly) {
symbols._tree = extracted.tree;
}correctly gates the
Phase 5: Backlog Compliance
Critical Concerns1. WASM tree leak on 2. Scope broadening of this PR: Final Recommendation |
Greptile SummaryThis PR fixes a silent no-op:
Confidence Score: 5/5Safe to merge — the change is a minimal, targeted parameter plumb with correct default semantics and proper WASM memory disposal. The inline path now correctly skips the No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant parseFilesWasmForBackfill
participant parseFilesWasmInline
participant parseFilesWasm_workerPool as parseFilesWasm (worker pool)
participant wasmExtractSymbols
Caller->>parseFilesWasmForBackfill: "filePaths, rootDir, {symbolsOnly}"
alt "filePaths.length <= 16 (inline path)"
parseFilesWasmForBackfill->>parseFilesWasmInline: filePaths, rootDir, symbolsOnly
loop each file
parseFilesWasmInline->>wasmExtractSymbols: parsers, filePath, code
wasmExtractSymbols-->>parseFilesWasmInline: symbols, tree, langId
alt "symbolsOnly = false"
parseFilesWasmInline->>parseFilesWasmInline: "symbols._tree = extracted.tree"
else "symbolsOnly = true"
parseFilesWasmInline->>parseFilesWasmInline: extracted.tree.delete()
end
end
parseFilesWasmInline-->>Caller: Map relPath to ExtractorOutput
else "filePaths.length > 16 (worker-pool path)"
parseFilesWasmForBackfill->>parseFilesWasm_workerPool: filePaths, rootDir, mode
parseFilesWasm_workerPool-->>Caller: Map relPath to ExtractorOutput
end
Reviews (7): Last reviewed commit: "chore: merge origin/main into fix/symbol..." | Re-trigger Greptile |
| paths: | ||
| - "src/extractors/**" | ||
| - "src/domain/graph/**" | ||
| - "crates/**" | ||
| - "scripts/benchmark.ts" | ||
| - "scripts/incremental-benchmark.ts" | ||
| - "scripts/lib/bench-config.ts" | ||
| - "scripts/lib/fork-engine.ts" |
There was a problem hiding this comment.
Path filter misses
src/domain/parser.ts
parseFilesWasmForBackfill and parseFilesWasmInline live in src/domain/parser.ts, but that path is not in the paths: filter. If a future PR touches only parser.ts (exactly as this one does), the canary will silently not run, leaving the very optimization this fix plumbs — skipping _tree assignment on the inline path — unguarded against performance regressions. The PR description explicitly calls out that 1-file incremental rebuilds are the target scenario, so measuring them without guarding parser.ts changes is an incomplete safety net.
| paths: | |
| - "src/extractors/**" | |
| - "src/domain/graph/**" | |
| - "crates/**" | |
| - "scripts/benchmark.ts" | |
| - "scripts/incremental-benchmark.ts" | |
| - "scripts/lib/bench-config.ts" | |
| - "scripts/lib/fork-engine.ts" | |
| paths: | |
| - "src/extractors/**" | |
| - "src/domain/graph/**" | |
| - "src/domain/parser.ts" | |
| - "crates/**" | |
| - "scripts/benchmark.ts" | |
| - "scripts/incremental-benchmark.ts" | |
| - "scripts/lib/bench-config.ts" | |
| - "scripts/lib/fork-engine.ts" |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed — added src/domain/parser.ts to the paths: filter in .github/workflows/perf-canary.yml. The inline-path optimization introduced by this PR is now guarded against future regressions in parseFilesWasmInline/parseFilesWasmForBackfill.
Also took the opportunity to fix the minor WASM tree leak raised by the Claude review: parseFilesWasmInline now calls .delete() on the parsed tree when symbolsOnly=true, matching the disposal pattern already used by the extractor-error path.
Codegraph Impact Analysis2 functions changed → 10 callers affected across 6 files
|
…sOnly inline path Guard the inline-path optimization against regressions by adding src/domain/parser.ts to the perf-canary paths filter — without it the canary silently skips exactly the file this PR modifies. Also free the WASM-backed tree when symbolsOnly=true in parseFilesWasmInline. The tree was being parsed and then discarded without an explicit .delete() call, leaking WASM linear memory on every incremental rebuild that triggers the inline path. The deletion is guarded by a typeof check, matching the pattern used by the extractor-error path at line 1078.
|
Addressed both concerns from the review:
|
Resolves add/add conflicts in .claude/hooks/snapshot-pre-bash.sh and .claude/hooks/track-bash-writes.sh — taking the origin/main version which adds CMD_HASH to the snapshot filename to prevent parallel Bash calls from overwriting each other's baseline.
|
Resolved merge conflicts with origin/main — two add/add conflicts in |
|
Resolved new merge conflict with main (commit 5bc8196). The only conflict was an add/add in |
parseFilesWasmForBackfill'ssymbolsOnlyflag was silently ignored for batches ≤16 files becauseparseFilesWasmInline(the inline path) didn't accept or propagate the option. The optimization from PR #1436 only applied to the worker-pool path (>16 files).Plumbs
symbolsOnlythroughparseFilesWasmInline→ extractor entry points, skipping the_treeassignment that triggers CFG/complexity/dataflow/AST visitor walks when only symbol+call extraction is needed. This makes the optimization effective for typical 1-file incremental rebuilds.Closes #1437